#ifndef CAMERA_COLLEGE_ZERO_COPY_H
#define CAMERA_COLLEGE_ZERO_COPY_H

#include <thread>
#include <GxIAPI.h>
#include <atomic>
#include "FrameData.h"
#include "ThreadSafeQueue.h"

class CameraCollegeZeroCopy
{
public:
    //在构造前应该确保发送了开采命令
    CameraCollegeZeroCopy(GX_DEV_HANDLE* ptrDevice,ThreadSafeQueue<FrameData>* ptrQueue,unsigned bufferSize=100);
    ~CameraCollegeZeroCopy();
private:
    uint64_t StartTime;
    bool firstImage=true;
    std::thread HandleThread;
    PGX_FRAME_BUFFER* pFrameBuffer;
    PGX_FRAME_BUFFER* pFrameBufferHandle;
    GX_DEV_HANDLE* ptrDevice;
    ThreadSafeQueue<FrameData>* ptrQueue;
    unsigned FrameBufferSize;
    std::atomic<unsigned> CollegeImageSize=0;
    std::atomic<bool> ThreadExitFlag=false;
    void HandleFunc();
};

#endif
